/**
 * 天数修改
 * @constructor
 */
function SetBirthDay() {
}

SetBirthDay.init = function () {

}
//操作相关方法****************************
function log() {
    if(!validateForm()) return false;
    var postdata={
        birthDay: $("#text_conservationDay").val(),
    };
    $.ajax({
        url:"/setBirthDay/update",
        type:"post",
        data:JSON.stringify(postdata),
        contentType:"application/json",
        dataType:"json",
        success:function(data){
            if (data.code === "200") {
                swal("修改成功!", "请继续操作", "success");
            }else{
                swal("修改失败!", "请重试", "error");
            }
        }
    })
}

function validateForm() {
    //validate方法参数可选
    return $("#myformdata").validate({
        rules: {
            text_conservationDay: {
                required: true,//必填
                minlength: 1, //最少1个字符
                maxlength: 50,//最多50个字符
                number: true, //必须是数字
            },
        },
        //错误信息提示
        messages: {
            text_conservationDay: {
                required: "(必填)",
                minlength: "最少1位",
                maxlength: "最长50位",
                number: "必须输入数字",
            },
        },
    }).form();
}
